import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        {
            path: '/login',
            component: () => import('../components/pages/login.vue')
        },
        {
            path: '/',
            component: () => import('../components/pages/layout.vue'),
            redirect: '/home',
            children: [
                {
                    path: '/home',
                    component: () => import('../components/pages/home')
                },{
                    path: '/admin',
                    component: () => import('../components/pages/admin/index')
                },{
                    path: '/admin/add',
                    component: () => import('../components/pages/admin/edit')
                },{
                    path: '/admin/:id',
                    component: () => import('../components/pages/admin/edit')
                },{
                    path: '/menu',
                    component: () => import('../components/pages/menu/index')
                },{
                    path: '/menu/add',
                    component: () => import('../components/pages/menu/edit')
                },{
                    path: '/menu/:id',
                    component: () => import('../components/pages/menu/edit')
                },{
                    path: '/role',
                    component: () => import('../components/pages/role/index')
                },{
                    path: '/role/add',
                    component: () => import('../components/pages/role/edit')
                },{
                    path: '/role/:id',
                    component: () => import('../components/pages/role/edit')
                }
            ]
        }
    ]
})

export default router;